home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / c-tools / tds / convsrc / pcq2msg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-01  |  894 b   |  58 lines

  1. /* PCQ2Msg.c */
  2.  
  3. #include <exec/types.h>
  4. #include <dos/stdio.h>
  5. #include <clib/dos_protos.h>
  6.  
  7. #include <stdio.h>
  8. #include <string.h>
  9.  
  10. static UBYTE version[] = "$VER: PCQ2Msg 1.00 (28.01.94)";
  11.  
  12. struct ErrorMsg {
  13.   BOOL warn;
  14.   LONG row,col;
  15.   UBYTE fileName[256];
  16.   UBYTE errStr[256];
  17. };
  18.  
  19.  
  20. void 
  21. PrintMsg(struct ErrorMsg *msg)
  22. {
  23.   printf("<%s> %d %c <%s>\n",msg->fileName,msg->row,(msg->warn ? 'W' : 'E'),msg->errStr);
  24. }
  25.  
  26.  
  27. /* PCQ 1.2b using -q option
  28. "foo.p" At 7,6 : Unknown ID
  29. "foo.p" At 11,2 : Unknown ID
  30. */
  31.  
  32. BOOL
  33. ConvertMsg(struct ErrorMsg *msg)
  34. {
  35. UBYTE line[256];
  36.  
  37.   while (ReadLn(line,255)) {
  38.     if (sscanf(line,"\"%[^\"]\" At %d,%d : %[^\n]",msg->fileName,
  39.         &msg->row,&msg->col,msg->errStr) == 4) {
  40.       return(TRUE);
  41.     }
  42.   }
  43.   return(FALSE);
  44. }
  45.  
  46.  
  47. int
  48. main(int argc,UBYTE *argv[])
  49. {
  50. struct ErrorMsg errMsg;
  51.  
  52.   while (ConvertMsg(&errMsg))
  53.     PrintMsg(&errMsg);
  54.  
  55.   return(0);
  56. }
  57.  
  58.